class Solution:
    def permutation(self, s: str):
        self.res, self.tmp = [], ''
        def recur(string):
            n = len(string)
            if n == 1:
                self.res.append(self.tmp + string)
            else:
                for i in range(n):
                    self.tmp += string[0]
                    recur(string[1:])
                    self.tmp = self.tmp[:-1]
                    string = string[1:]+string[0]
        recur(s)
        return self.res

if __name__ == '__main__':
    c = Solution()
    c.permutation("abc")